
//
//  MZdetail.m
//  民族文化宫
//
//  Created by kobehjk on 14-8-12.
//  Copyright (c) 2014年 WANG CUNRUI. All rights reserved.
//

#import "MZdetail.h"
@interface MZdetail()
{
    UIButton *_button1; // 被选中的标签
}
@end
@implementation MZdetail

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _button1 = [UIButton buttonWithType:UIButtonTypeCustom];
        //    [_button1 setBackgroundImage:[UIImage imageNamed:@"map.png"] forState:UIControlStateNormal];
        _button1.frame = CGRectMake(0, 0, 15, 15);
        _button1.layer.cornerRadius = 8;
        [_button1 setTitle:@"展厅一楼" forState:UIControlStateNormal];
        [_button1 addTarget:self action:@selector(butClick1:) forControlEvents:UIControlEventTouchUpInside];
        [_button1 setBackgroundColor:[UIColor clearColor]];
        _button1.tag = 1;
        [self addSubview:_button1];
        UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
        button2.frame = CGRectMake(105, 0, 10, 10);
        button2.layer.cornerRadius = 8;
        [button2 setTitle:@"展厅一楼" forState:UIControlStateNormal];
        [button2 addTarget:self action:@selector(butClick2:) forControlEvents:UIControlEventTouchUpInside];
        [button2 setBackgroundColor:[UIColor clearColor]];
        button2.tag = 1;
        [self addSubview:button2];
        UILabel *label= [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 120, 10)];
        label.font = [UIFont boldSystemFontOfSize:10];
        label.textColor = [UIColor blackColor];
        label.textAlignment = NSTextAlignmentCenter;
        label.numberOfLines = 3;
        label.text = @"古代陶瓷艺术展";
        [label setBackgroundColor:[UIColor clearColor]];
        [self addSubview:label];
        UIImageView *moImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_arrow.png"]];
        moImage.frame = CGRectMake(105, 0, 10,10);
        [self addSubview:moImage];
        UIImageView *moImage1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_arrow.png"]];
        moImage1.frame = CGRectMake(0, 0, 10,10);
        [self addSubview:moImage1];
        
    }
    return self;
}

- (void)setFrame:(CGRect)frame
{
    frame.size = CGSizeMake(120, 10);
    [super setFrame:frame];
}

- (void)butClick1:(UIButton *)but
{
    
    if (![_delegate respondsToSelector:@selector(detail:tag:)]) {
     [_delegate detail:self tag:_button1.tag];
    }
    NSLog(@"hello");
}

- (void)butClick2:(UIButton *)but
{
    NSLog(@"hello");
    [_delegate detail:self tag:_button1.tag];
    

}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
